package com.ruoyi.zxjd.work.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zxjd.work.domain.WorkTemplateTable5;
import com.ruoyi.zxjd.work.domain.bo.WorkProgressBO;
import com.ruoyi.zxjd.work.service.IWorkTemplateTable5Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 市纪委监委信访移送件办理情况登记Controller
 * 
 * @author lcc
 * @date 2021-03-01
 */
@Controller
@RequestMapping("/work/templatetable5")
public class WorkTemplateTable5Controller extends BaseController
{
    private String prefix = "work/templatetable5";

    @Autowired
    private IWorkTemplateTable5Service workTemplateTable5Service;

    @RequiresPermissions("work:templatetable5:view")
    @GetMapping()
    public String templatetable5()
    {
        return prefix + "/templatetable5";
    }

    /**
     * 查询市纪委监委信访移送件办理情况登记列表
     */
    @RequiresPermissions("work:templatetable5:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WorkTemplateTable5 workTemplateTable5)
    {
        startPage();
        List<WorkTemplateTable5> list = workTemplateTable5Service.selectWorkTemplateTable5List(workTemplateTable5);
        return getDataTable(list);
    }

    /**
     * 导出市纪委监委信访移送件办理情况登记列表
     */
    @RequiresPermissions("work:templatetable5:export")
    @Log(title = "市纪委监委信访移送件办理情况登记", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WorkTemplateTable5 workTemplateTable5)
    {
        List<WorkTemplateTable5> list = workTemplateTable5Service.selectWorkTemplateTable5List(workTemplateTable5);
        ExcelUtil<WorkTemplateTable5> util = new ExcelUtil<WorkTemplateTable5>(WorkTemplateTable5.class);
        return util.exportExcel(list, "templatetable5");
    }

    /**
     * 新增市纪委监委信访移送件办理情况登记
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存市纪委监委信访移送件办理情况登记
     */
    @RequiresPermissions("work:templatetable5:add")
    @Log(title = "市纪委监委信访移送件办理情况登记", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(WorkProgressBO workProgressBO)
    {
        return toAjax(workTemplateTable5Service.insertWorkTemplateTable5(workProgressBO));
    }

    /**
     * 修改市纪委监委信访移送件办理情况登记
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        WorkTemplateTable5 workTemplateTable5 = workTemplateTable5Service.selectWorkTemplateTable5ById(id);
        mmap.put("workTemplateTable5", workTemplateTable5);
        return prefix + "/edit";
    }

    /**
     * 修改保存市纪委监委信访移送件办理情况登记
     */
    @RequiresPermissions("work:templatetable5:edit")
    @Log(title = "市纪委监委信访移送件办理情况登记", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WorkTemplateTable5 workTemplateTable5)
    {
        return toAjax(workTemplateTable5Service.updateWorkTemplateTable5(workTemplateTable5));
    }

    /**
     * 删除市纪委监委信访移送件办理情况登记
     */
    @RequiresPermissions("work:templatetable5:remove")
    @Log(title = "市纪委监委信访移送件办理情况登记", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(workTemplateTable5Service.deleteWorkTemplateTable5ByIds(ids));
    }
}
